/**
 * @file   AcctOpnService.java
 * @date   2012-11-22上午12:21:49
 * @author User
 */
package com.gzceb.zhgjj.service;

import com.gzceb.zhgjj.web.dao.AcctOpenDAO;
import com.gzceb.zhgjj.web.entity.AcctOpen;

/**
 * <p>客户开户服务层类。</p>
 *
 * @date   2012-11-22上午12:21:49 
 * @author liqing
 * @description 
 */
public class AcctOpnService {
	
	private AcctOpenDAO acctOpenDAO;
	
	public AcctOpnService(){
		
	}

	public AcctOpenDAO getAcctOpenDAO() {
		return acctOpenDAO;
	}

	public void setAcctOpenDAO(AcctOpenDAO acctOpenDAO) {
		this.acctOpenDAO = acctOpenDAO;
	}
	
	/**
	 * 判断是否客户开户信息已经存在于数据库info_acctopen中
	 * @param contCode String
	 * @return boolean
	 * 
	 */
	public boolean isExist(String contCode){
		AcctOpen acctOpen = new AcctOpen();
		acctOpen = (AcctOpen)acctOpenDAO.findByContcode(contCode).get(0);
		if(null == acctOpen || !(acctOpen instanceof AcctOpen)){
			return false;
		}else{
			return true;
		}
	}
	
	/**
	 * 存储一条客户开户记录到数据库
	 * @param AcctOpen对象
	 * @return boolean
	 */
	public boolean saveToDB(AcctOpen acctOpen){
		boolean isSuc = true;
		try{
			acctOpenDAO.save(acctOpen);
		}catch(RuntimeException re){
			isSuc = false;
		}
		
		return isSuc;
	}

}
